package glen.util;

import org.primefaces.component.datatable.DataTable;

import java.io.Serializable;
import java.util.List;

/**
 * Created by Test on 3/8/14.
 */
public class BaseManageBean<T, S> implements Serializable {

    protected transient DataTable dtResult = new DataTable();

    protected List<T> resultSearch;
    protected T selected;
    protected Class<T> type;
    protected transient S svr;

    public BaseManageBean(Class<T> dto, Class<S> service) throws IllegalAccessException, InstantiationException {
        type = dto;
        svr = service.newInstance();
        selected = type.newInstance();
    }

    public T getSelected() {
        return selected;
    }

    public void setSelected(T selected) {
        this.selected = selected;
    }


    public DataTable getDtResult() {
        return dtResult;
    }

    public void setDtResult(DataTable dtResult) {
        this.dtResult = dtResult;
    }

    public List<T> getResultSearch() {
        return resultSearch;
    }

    public void setResultSearch(List<T> resultSearch) {
        this.resultSearch = resultSearch;
    }

    public void reset() {
        resultSearch = null;

    }
}
